import socketserver
ip_port = ("localhost", 1234)
class MyUDPServer(socketserver.BaseRequestHandler):
    def handle(self):
        print(self.request)
        print("收到客户端的消息是：",self.request[0])
        print("客户端的地址是：",self.client_address)
        print(self.request[1])
        while True:
            data=self.request[0]
            if not data:break
            self.request[1].sendto(self.request[0].upper(),self.client_address)
if __name__ == '__main__':
    udp_server=socketserver.ThreadingUDPServer(ip_port,MyUDPServer)
    print("等待客户端发送消息...")
    udp_server.serve_forever()